%%%%%%Use to combine cf_classification_hadvdid_masks output into a single
%%%%%%dataset for each ROI. 

subnums=[2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,39,40];

    for val=1:2
        if val==1
            obj='lv'
        else obj='hv'
        end
        
        for cursub=1:length(subnums)
            if subnums(cursub) < 10
                s = ['0',num2str(subnums(cursub))]
            else s = num2str(subnums(cursub))
            end
    
            cd(['desisl_',s,'/desisl_',s,'.results/hadvdid_class'])
        
            load(['B81_',obj,'_svm_MATLAB_hadvdid_rois.mat'])
        
            hadvdid_roi1_avg_accuracy(cursub,:)=avg_accuracy(1,:);
            hadvdid_roi2_avg_accuracy(cursub,:)=avg_accuracy(2,:);
            hadvdid_roi3_avg_accuracy(cursub,:)=avg_accuracy(3,:);
            hadvdid_roi4_avg_accuracy(cursub,:)=avg_accuracy(4,:);
            hadvdid_roi5_avg_accuracy(cursub,:)=avg_accuracy(5,:);
            hadvdid_roi6_avg_accuracy(cursub,:)=avg_accuracy(6,:);
            hadvdid_roi7_avg_accuracy(cursub,:)=avg_accuracy(7,:);
            hadvdid_roi8_avg_accuracy(cursub,:)=avg_accuracy(8,:);
            hadvdid_roi9_avg_accuracy(cursub,:)=avg_accuracy(9,:);
            hadvdid_roi10_avg_accuracy(cursub,:)=avg_accuracy(10,:);
            hadvdid_roi11_avg_accuracy(cursub,:)=avg_accuracy(11,:);
            hadvdid_roi12_avg_accuracy(cursub,:)=avg_accuracy(12,:);
            hadvdid_roi13_avg_accuracy(cursub,:)=avg_accuracy(13,:);
            hadvdid_roi14_avg_accuracy(cursub,:)=avg_accuracy(14,:);
            hadvdid_allrois_avg_accuracy(cursub,:)=avg_accuracy(15,:);
        
            hadvdid_roi1_avg_scores(cursub,:)=avg_scores(1,:);
            hadvdid_roi2_avg_scores(cursub,:)=avg_scores(2,:);
            hadvdid_roi3_avg_scores(cursub,:)=avg_scores(3,:);
            hadvdid_roi4_avg_scores(cursub,:)=avg_scores(4,:);
            hadvdid_roi5_avg_scores(cursub,:)=avg_scores(5,:);
            hadvdid_roi6_avg_scores(cursub,:)=avg_scores(6,:);
            hadvdid_roi7_avg_scores(cursub,:)=avg_scores(7,:);
            hadvdid_roi8_avg_scores(cursub,:)=avg_scores(8,:);
            hadvdid_roi9_avg_scores(cursub,:)=avg_scores(9,:);
            hadvdid_roi10_avg_scores(cursub,:)=avg_scores(10,:);
            hadvdid_roi11_avg_scores(cursub,:)=avg_scores(11,:);
            hadvdid_roi12_avg_scores(cursub,:)=avg_scores(12,:);
            hadvdid_roi13_avg_scores(cursub,:)=avg_scores(13,:);
            hadvdid_roi14_avg_scores(cursub,:)=avg_scores(14,:);
            hadvdid_allrois_avg_scores(cursub,:)=avg_scores(15,:);
            
            cd ../../../
            
        end
        
        save(['hadvdid_',obj,'_classification_averages_across_subj.mat'])
        
    end
        
        
    
    